using System.Collections.Generic;
using System.Data;
using Lamex.Base.Framework.BaseAbs; 
using Lamex.Base.Framework.BaseDal; 
using  Lamex.SIESystemManager.Interface; 
using  Lamex.SIESystemManager.Model; 
namespace Lamex.SIESystemManager.DalServer 
{
 public class B_IE_SJData_Import : BaseDalSQL<B_IE_SJData_ImportInfo>,IB_IE_SJData_Import
  {
        public int IsExistDrawRecord(string DrawNum)
        {
            int m = 0;
            string sql = "select top 1 * from [Edgeband_Program].dbo.Initial_Data where Drawing_Num='"+ DrawNum + "'";
            if (base.GetDataTableBySql(sql).Rows.Count > 0) m = 1;
            return m;
        }
        //Stander
        public DataTable NotFinish(string DrawNum)
        {
            int m = 0;
            string sql = "select * from [Edgeband_Program].dbo.Initial_Data where Drawing_Num collate Chinese_PRC_CI_AS not in  (select DRAWING_NUMBER from B_IE_Operation_Data) ";
            return base.GetDataTableBySql(sql);
        }
        public DataTable HasFinish(string DrawNum)
        {
            int m = 0;
            string sql = "select * from [Edgeband_Program].dbo.Initial_Data where Drawing_Num collate Chinese_PRC_CI_AS  in  (select DRAWING_NUMBER from B_IE_Operation_Data) ";
            return base.GetDataTableBySql(sql);
        }

        //Stander
        public DataSet StanderDataSet()
        {
            int m = 0;
            string sql = @"select * from B_IE_SJData_Import where   isnull(DRAWING_NO_SJ,'')='' and deleted !=1 order by CREATE_TIME desc;
                           select * from B_IE_SJData_Import where DRAWING_NO_STANDARD collate Chinese_PRC_CI_AS not in  (select DRAWING_NUMBER from B_IE_Operation_Data)  and isnull(DRAWING_NO_SJ,'')='' order by CREATE_TIME desc;
                           select * from B_IE_SJData_Import where DRAWING_NO_STANDARD collate Chinese_PRC_CI_AS  in  (select DRAWING_NUMBER from B_IE_Operation_Data)  and isnull(DRAWING_NO_SJ,'')='' order by CREATE_TIME desc ";
            return base.GetDataSetBySql(sql);
        }

        public int ImportDrawRecord(string DrawNum)
        {
            int m = 0;
            string sql = "select top 1 * from B_IE_SJData_Import where DRAWING_NO_STANDARD='" + DrawNum + "'";
            if (base.GetDataTableBySql(sql).Rows.Count > 0) m = 1;
            return m;
        }
        //Stander
        public DataSet SJDataSet()
        {
            int m = 0;
            string sql = @"select * from B_IE_SJData_Import where   isnull(DRAWING_NO_SJ,'')!='' and isnull(DRAWING_NO_STANDARD,'')!='' order by CREATE_TIME desc ;
                           select * from B_IE_SJData_Import where DRAWING_NO_SJ collate Chinese_PRC_CI_AS not in  (select DRAWING_NUMBER from B_IE_Operation_Data)  and isnull(DRAWING_NO_SJ,'')!=''  order by CREATE_TIME desc;
                           select * from B_IE_SJData_Import where DRAWING_NO_SJ collate Chinese_PRC_CI_AS  in  (select DRAWING_NUMBER from B_IE_Operation_Data)  and isnull(DRAWING_NO_SJ,'')!='' order by CREATE_TIME desc";
            return base.GetDataSetBySql(sql);
        }

        //sj
       
    }
};
